﻿<style>
    #UserDeptTree .layui-tree-txt { color: black !important; }
</style>
<div class="content-top-nav">
    <div class="layui-row">
        <div class="layui-col-md11">
            <h3 style="color:#444">
                <i class="layui-icon layui-icon-home"></i>
                用户管理
            </h3>
        </div>
        <div class="layui-col-md1" style="text-align:right;">
        </div>
    </div>
    <hr>
</div>

<div style="margin-bottom:50px;">
    <div class="layui-row">
        <div class="layui-col-md2" style="padding:20px 0 0 20px;height:100%;">
            <div id="UserDeptTree"></div>
        </div>
        <div class="layui-col-md10">
            <div id="userListMain">
            </div>
        </div>
    </div>
</div>

<script>

    $("#userListMain").load("/Admin/User/Index?did=0");

    layui.define(function () {
        var tree = layui.tree, $ = layui.jquery;
        $.getJSON('/Admin/UserDept/GetTree', function (res) {
            tree.render({
                elem: '#UserDeptTree',  //绑定元素
                data: res,
                text: {
                    defaultNodeName: '未命名' //节点默认名称
                    , none: '无数据' //数据为空时的提示文本
                },
                click: function (res) {
                    $("#userListMain").load("/Admin/User/Index?did=" + res.data.id);
                }
            });
            //console.log("res",res);
        })
    });
</script>